<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<script type="text/javascript" src="js/jquery-1.10.2.min.js">
</script>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Login</title>
  <link rel="shortcut icon" href="images/zk.ico" type="image/x-icon" />
<link rel="stylesheet" href="lib/layui/css/layui.css">
<link rel="stylesheet" href="css/login.css">
<link rel="stylesheet" href="css/bootstrap.min.css" />
<script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
 <style type="text/css">
   div{
     height: 400px;
		width: 500px;
		margin: 100px auto;
   }
 </style>
   <script type="text/javascript">
  
      //获取主机地址+项目名，如：//localhost:8080/hospital
 var ctx = "${ctx}";
  </script>
</head>
<body>
 
 
 
 
 <div>
 

		
<form action="addSuff.do">


病人名:<input type="text"  name="sname" class="form-control"maxlength="8">

性别:<select name="ssex"  class="form-control">   
                <option value="1" >男</option>   
                <option value="2" >女</option>  </select> 
		          
年龄:<input type="text" name="sage" class="form-control"maxlength="2">
手机号:<input type="text" name="sphone" class="form-control" maxlength="11">
地址:<input type="text" name="saddre" class="form-control"><br>

所属科室:<select id="department"  onchange="finddoctor()" >
										<option >-请选择科室-</option>
										<c:forEach var="item" items="${list2}">
											<option value="${item.deid}" />${item.dename}
										</c:forEach>
									</select>
							
								
			<label class="control-label control-label-m">选择医生</label>

								
									<select id="doctor" name="eid" >
										<option class="aa" id="all" value="0">-请选择医生-</option>
										
									</select>
								
							<br>
						


			<input type="submit" value="确认挂号" class="btn btn-primary pull-left facebook">
	</form>
		<br>
</div>

	<script type="text/javascript">
	//根据科室部门查询医生
	 function getselect(){
		 document.getElementById("all").style.display="none";
		$(".aa").nextAll().remove();
		$("#all").nextAll().remove();
		$.post(ctx +"/getdoctorbydptid.do",
		{deid:$("#department").val() == "" ? 0 : $("#department").val()},
		
		function(data){					
			$.each(data,function(name,value) {
				$("#doctor").append("<option value='"+value['eid']+"'>"+value['ename'] + "</option>");
			});
			$("#doctor").val(0);
			$("#doctor").trigger("liszt:updated");
    		/* $("#doctor").chosen(); */
		});
	}
	
	 function alertTest()
	  {
	  alert("下拉框内容发生改变")
	  }
	//根据科室部门查询医生
	function finddoctor(){
		getselect();
		//alertTest();
	}
	
	
	</script>	

</body>

 
</html>